<template>
  <!-- 施工进度说明 -->
  <div style="height:520px">
    <!-- 搜索 -->
    <TopFilter
      :collapse='collapseVale'
       ref='infoProjectPhoto'
      v-if="value.type!=='show'"
      :list="topFilterInit"
      :cols="2"
      labelWidth="100"
      @filterChange="changeHandle"
    ></TopFilter>
    <!-- table -->
    <FilterTable
      height="300"
      ref="table"
      :columns="columns"
      :isSelectColumn="isSelectColumn"
      :fetchapi="fetchParams"
      :params="flterValue"
      :datakey="'records'"
      :onColumnsChange="columns => this.columns = columns"
    >
    </FilterTable>
  </div>
</template>
<script>
import { dictionary } from '@/utils/dictMixin';
export default {
  mixins: [dictionary],
  props: {
    value: {
      type: Object,
      required: true
    }
  },
  data() {
    return {
      collapseVale:false,
      isSelectColumn: false,
      initData: {},
      topFilterInit: this.topFilterInitFun(),
      flterValue: {}, //参数
      columns: this.creatHeader(),
      fetchParams: null //ipa 接口
    };
  },
  mounted() {
    console.log(this.value)
  },
  methods: {
    //搜索数据
    topFilterInitFun() {
      return [
        { type: 'SELECT', label: '项目', fieldName: 'field2', placeholder: '请选择', initialValue: '', itemList:[] },
        { type: 'SELECT', label: '子项目', fieldName: 'field3', placeholder: '请选择', initialValue: '',  itemList:[] },
        { type: 'SELECT', label: '审核结果', fieldName: 'field31', placeholder: '请选择', initialValue: '', itemList: this.createDictList('1008') },
        { type: 'RANGE_DATE',  label: '上传日期',  fieldName: 'field22',  valueFormat: 'yyyy-MM-dd',   initialValue: '', placeholder: '请选择' }
     ];
    },
    //搜索获取数据
    changeHandle(val) {
      this.flterValue = val;
      console.log(val);
    },
    //table表头和数据源
    creatHeader() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 80,
          sorter: true,
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        { title: '项目', dataIndex: 'field2', sorter: true },
        { title: '子项目', dataIndex: 'field3', sorter: true },
        { title: '附件', dataIndex: 'field4', sorter: true,
         unitRender: () => {
            return <el-button slot="append" icon="el-icon-search">附件.xls</el-button>
         }},
        { title: '上传日期', dataIndex: 'field6', sorter: true },
        { title: '审核结果', dataIndex: 'field7', sorter: true },
        { title: '审核说明', dataIndex: 'field8',  sorter: true  }
      ];
    }
   }
};
</script>

<style lang="less" scoped>
</style>
